#!/bin/sh
#1.获取日期
today=$1
#2.在hdfs创建文件夹
echo ${today}'=====================>:创建文件夹'
hadoop fs -mkdir /wb_data/topic/${today}/
hadoop fs -mkdir /wb_data/comments/${today}/
#3.数据上传到hdfs
echo ${today}'=====================>:数据上传到hdfs'
hadoop fs -put /data/dataset/weibo/${today}-topic.csv  /wb_data/topic/${today}/
hadoop fs -put /data/dataset/weibo/${today}-Comments.csv  /wb_data/comments/${today}/
#4.hive创建相应分区
echo ${today}'=====================>:创建分区'
hive -e "ALTER TABLE wb_topic ADD PARTITION(actiondate='${today}') LOCATION '/wb_data/topic/${today}';"
hive -e "ALTER TABLE wb_comment ADD PARTITION(actiondate='${today}') LOCATION '/wb_data/comments/${today}';"